/*
 *   This File is Part of CuteOgre Game Engine
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	Copyright 2010 Alexandre Pires ( c.alexandre.pires@gmail.com )
 *  Created on: 2010/08/22
 */

#include "MainMenuState.h"
#include "GUIManager.h"
#include "GameEngine.h"

template<> MainMenuState* Singleton<MainMenuState>::ms_Singleton =
		0;

MainMenuState::MainMenuState(QObject* rParent ) : QObject (rParent) {
}

MainMenuState::~MainMenuState() {
	// TODO Auto-generated destructor stub
}

MainMenuState& MainMenuState::getSingleton(void) {
	assert( ms_Singleton );
	return (*ms_Singleton);
}

MainMenuState* MainMenuState::getSingletonPtr(void) {
	return ms_Singleton;
}

void MainMenuState::update() {
	RenderManager::getSingleton().update();
}

void MainMenuState::init(const QString & rScript) {
	GUIManager::load("MainMenu.xml");
	mPaused = false;
}

void MainMenuState::injectKeyReleased(int rKey) {

}

void MainMenuState::pause() {
	mPaused = true;
}

void MainMenuState::injectMouseMoved(int rX, int rY, int rZ) {

}

void MainMenuState::injectMousePressed(int rX, int rY, int rMouseButton) {

}

void MainMenuState::resume() {
	mPaused = false;
}

void MainMenuState::cleanup() {
	GUIManager::unload("MainMenu.xml");
	mPaused = true;
}

void MainMenuState::injectKeyPressed(int rKey, unsigned int rText) {
	switch ( rKey ) {
	case InputManager::Escape:
		GameEngine::getSingleton().finish();
	default:
		break;
	}
}

void MainMenuState::injectMouseReleased(int rX, int rY, int rMouseButton) {

}
